package com.hank.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hank.entity.User;
import com.hank.entity.vo.UserInfoVo;
import com.hank.mapper.UserMapper;
import com.hank.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hank.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.awt.print.Pageable;
import java.util.List;
import java.util.Objects;


/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author hank
 * @since 2023-04-23
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Resource
    UserMapper userMapper;

    @Override
    public R getUserPage(int current, int size) {
        List<UserInfoVo> userPage = userMapper.getUserPage((current - 1) * size, size);
        return Objects.requireNonNull(R.ok().put("result", userPage)).put("total",userPage.size());
    }
}
